<!DOCTYPE html>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="./public/admin/bootstrap/css/bootstrap.min.css"/>
		<link rel="stylesheet" type="text/css" href="./public/admin/bootstrap/css/bootstrap-responsive.min.css"/>
		<script src="bootstrap/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="./public/admin/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="./public/admin/css/shopping.css"/>
		<link rel="stylesheet" type="text/css" href="./public/admin/css/pay_header.css"/>
		<link rel="stylesheet" type="text/css" href="./public/admin/css/footer.css"/>
		<style type="text/css">
			#gnum{
				width: 20px;
				text-align: center;
				border-radius: 0;
				margin-bottom: 0;
			}
			#one-all{
				width: 60px;
				text-align: center;
				border:0px;
				margin-bottom: 0;
				font-size: 12px;
			}
		</style>
		<script type="text/javascript">
			$(function(){	
																		
				$('.add-num').click(function(){	
				num=parseInt($(this).parent('li').find('#gnum').val());								
				price=parseInt($('#one').attr('value'));																	
//									alert(1);									
					num=num+1;	
					if(num<=1){num=1;}								
				$(this).parent('li').find('#gnum').val(num);																
				})
												
				$('.raduce-num').click(function(){
				num=parseInt($(this).parent('li').find('#gnum').val());								
				price=parseInt($('#one').attr('value'));																	
//									alert(1);									
					num=num-1;	
					if(num<=1){num=1;}								
				$(this).parent('li').find('#gnum').val(num);															
				})																																							
			})
		</script>
		
		<script type="text/javascript">
			$(function(){
					
				$('.add-num').click(function(){	
				This=$(this);	
				 num = parseInt($(this).parent('li').find('.gnum').val());
				 sid = $(this).parent('li').find('.sid').val();
//				alert(sid);
				$.ajax({
					type:"post",
					url:"{{U('changenum')}}",
					data:{num:num,sid:sid},
					dataType:'json',
					success:function(phpData){		
//						alert();
						This.parents('.danpin').find('.oneTa').find('span').html('￥'+phpData.oneTotal+'.00');	
						$('.3r_1').html('商品总价（￥'+phpData.allTotal+'.00）- 活动（￥0.00）= 商品金额总计（￥'+phpData.allTotal+'.00）');											
						$('.3r_2').find('span').html('￥'+phpData.allTotal+'.00');
					}
				});				
			});
		})	
		</script>
		<script type="text/javascript">
			$(function(){
					
				$('.raduce-num').click(function(){	
				This=$(this);	
				 num = parseInt($(this).parent('li').find('.gnum').val());
				 sid = $(this).parent('li').find('.sid').val();
//				alert(sid);
				$.ajax({
					type:"post",
					url:"{{U('changenum')}}",
					data:{num:num,sid:sid},
					dataType:'json',
					success:function(phpData){		
//						alert();
						This.parents('.danpin').find('.oneTa').find('span').html('￥'+phpData.oneTotal+'.00');	
						$('.3r_1').html('商品总价（￥'+phpData.allTotal+'.00）- 活动（￥0.00）= 商品金额总计（￥'+phpData.allTotal+'.00）');											
						$('.3r_2').find('span').html('￥'+phpData.allTotal+'.00');
					}
				});				
			});
		})	
		</script>
		
		<script type="text/javascript">
			$(function(){

				$('.del_one').click(function(){
					This=$(this);		
					var sid = $(this).parent('li').siblings('.shu').find('.sid').val();
//					alert(sid);
					var num=0;
					$.ajax({
						type:"post",
						url:"{{U('delNum')}}",
						data:{sid:sid,num:num},
						dataType:'json',
						success:function(phpData){	
//							alert('删除成功');
							This.parents('.danpin').remove();
							$('.3r_1').html('商品总价（￥'+phpData.allTotal+'.00）- 活动（￥0.00）= 商品金额总计（￥'+phpData.allTotal+'.00）');											
							$('.3r_2').find('span').html('￥'+phpData.allTotal+'.00');
						}
					});
				});
			})
		</script>
		
		<title></title>
	</head>
	<body>
		{{include file="VIEW_PATH/Common/header_2.php"}}
		
		<article>
		<form action="{{U('Confirm/index')}}" 	method="post">							
			<div class="xinxi_1">
				<ul>
					<li style="width:40%;">商品信息</li>
					<li style="width:13%;">单价（元）</li>
					<li style="width:10%;">数量</li>
					<li style="width:10%;">小计（元）</li>
					<li style="width:27%;">操作</li>
				</ul>
			</div>
			<div class="xinxi_2">
				{{if value="$shopData"}}
				{{foreach from="$shopData" key="$k" value="$v"}}				
				<ul class="danpin">
					<li style="width:40%;">					
						<input class="cart-item-check " type="checkbox" name="glid[]" value="{{$k}}"  checked>
						<img src="{{$v['options']['pic']}}" style="height: 60px;"/>
						<p>
							<a href="">{{$v['name']}}</a>
							<span id="">颜色：{{$v['color']}} 尺码：{{$v['size']}}</span>
						</p>
					</li>
					<li style="width:13%;" id="one" value="{{$v['price']}}">￥{{$v['price']}}.00</li>
					<li style="width:10%;" class="shu">	
						<input type="hidden" name="" class="sid" id="" value="{{$k}}" />		
						<input type="button" class="raduce-num" id="raduce-num" value="-" style="width:20px;background: #ccc;"/>
						<input id="gnum" class="gnum" type="text" name="" id="" value="{{$v['num']}}" />
						<input type="button" class="add-num" id="add-num" value="+" style="width:20px;background: #ccc;"/>
					</li>
					<li style="width:10%;" class="oneTa">
						<span> ￥{{$v['total']}}.00</span>
					</li>
					<li style="width:26%;" class="change">
						<a href="javascript:;" class="del_one" style="margin-right: 40px;">删除</a> 
						<a href="">移入收藏</a> 
					</li>
				</ul>
				{{endforeach}}
				{{else}}
				<ul>
					<li style="width:100%; text-align: center;">购物车内没有商品</li>
				</ul>
				{{endif}}
			</div>
			
			<script type="text/javascript">
				$(function(){
					$('.checkall').click(function(){
//					alert(222);
//					获取当前对象的选中属性
					var re=$(this).is(':checked');
//					alert(re);					
					if(re){
//						$('.checkOne')
						

						$.each($('.cart-item-check'), function(){
							$(this).attr('checked','checked');
						});
					}else{
						$.each($('.cart-item-check'), function(){
							$(this).removeAttr('checked');
						});
					}
					
				})
				})
			</script>
			<div class="xinxi_3">
				<div class="xx_3l">
					 <input type="checkbox" class="checkall" >
					 <a href="">全选</a> 
					 <a href="{{U('Cart/del')}}">批量删除</a>  
					 <a href="">批量移入收藏夹</a> 
				</div>
				<div class="xx_3r">
					<p id="3r_1" class='3r_1' style="font-weight: bold;">商品总价（￥{{$allData['total']}}.00）- 活动（￥0.00）= 商品金额总计（￥{{$allData['total']}}.00）</p>
					<p id="3r_2" class='3r_2'> 商品总价（不含运费）： <span style="font-size: 16px; color: #e8044f;">￥{{$allData['total']}}.00 </span>元</p>
				</div>
			</div>
			
			<div class="jiesuan">
				<a href="" name="" id=""  class="zgg"/>再逛逛</a>
				{{if value="$shopData"}}
				<input class="qjs" type="submit" id="" name="" value="去结算 "/>
				{{endif}}
			</div>
		</form>
			<div class="coudan">
				<div class="cd_t"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;凑单商品</span></div>
				<ul>
					
					<li>
						<img src="./public/admin/images/pay/cd_p1.jpg"/>
						<a href="">TEEBACCO 卡通鳄鱼印花短袖T恤</a>
						<p id=""><del>￥119.00</del> ￥99.00</p>
					</li>
					<li>
						<img src="./public/admin/images/pay/cd_p1.jpg"/>
						<a href="">TEEBACCO 卡通鳄鱼印花短袖T恤</a>
						<p id=""><del>￥119.00</del> ￥99.00</p>
					</li>
					<li>
						<img src="./public/admin/images/pay/cd_p1.jpg"/>
						<a href="">TEEBACCO 卡通鳄鱼印花短袖T恤</a>
						<p id=""><del>￥119.00</del> ￥99.00</p>
					</li>
					<li>
						<img src="./public/admin/images/pay/cd_p1.jpg"/>
						<a href="">TEEBACCO 卡通鳄鱼印花短袖T恤</a>
						<p id=""><del>￥119.00</del> ￥99.00</p>
					</li>
					<li>
						<img src="./public/admin/images/pay/cd_p1.jpg"/>
						<a href="">TEEBACCO 卡通鳄鱼印花短袖T恤</a>
						<p id=""><del>￥119.00</del> ￥99.00</p>
					</li>
					<li style="border-right: 0;">
						<img src="./public/admin/images/pay/cd_p1.jpg"/>
						<a href="">TEEBACCO 卡通鳄鱼印花短袖T恤</a>
						<p id=""><del>￥119.00</del> ￥99.00</p>
					</li>
				</ul>
			</div>
		</article>
		{{include file="VIEW_PATH/Common/footer.php"}}
	</body>
</html>
